package cz.worsik.android.test.rideshare.fragments;

import android.app.Activity;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Adapter;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;

import java.util.ArrayList;
import java.util.List;

import cz.worsik.android.test.rideshare.MainActivity;
import cz.worsik.android.test.rideshare.R;
import cz.worsik.android.test.rideshare.constants.ViewConst;
import cz.worsik.android.test.rideshare.db.ContactAdapter;
import cz.worsik.android.test.rideshare.model.Contact;
import cz.worsik.android.test.rideshare.util.KalendarTools;

/**
 * Created by 231260 on 11.1.14.
 */
public class KontaktyFragment extends AbstractFragment {

    /**
     * The fragment argument representing the section number for this
     * fragment.
     */
    private static final String ARG_SECTION_NUMBER = "section_number";
    public static final int sectionNumber = 3;
    public static final String key = "CONTACTS";

    /**
     * Returns a new instance of this fragment for the given section
     * number.
     */
    public static KontaktyFragment newInstance() {
        KontaktyFragment fragment = new KontaktyFragment();

        fragment.setArguments(getBundle());
        return fragment;
    }

    public KontaktyFragment() {
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View rootView = inflater.inflate(R.layout.fragment_kontakty, container, false);

        List<Contact> list = new ArrayList<Contact>();
        list.add(new Contact(1,"Petr",true));
        list.add(new Contact(1,"Tom",true));
        list.add(new Contact(1,"Vendy",true));
/*
        ListView kontakty = (ListView) rootView.findViewById(R.id.contact_list);
        ContactAdapter ca = new ContactAdapter(
                rootView.getContext(),
                R.layout.radek_kontakt_listu
            );
        ca.setItems(list);
        kontakty.setAdapter(ca);
*/
        //TextView textView = (TextView) rootView.findViewById(R.id.section_label);
        //textView.setText(Integer.toString(getArguments().getInt(ARG_SECTION_NUMBER)));
        return rootView;
    }

    @Override
    public void onAttach(Activity activity) {
        super.onAttach(activity);
        ((MainActivity) activity).onFragmentnAttached(this);
    }

    public String getActionBarTitle() {
        return super.getActionBarTitle() + ": " + getString(R.string.title_section_kontakty);
    }
}
